package cn.zhouchao.basic.config;

import cn.zhouchao.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        System.out.println("后端拦截器！！！！");
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")//拦截所有
                .excludePathPatterns("/login/**")//登录放行
                .excludePathPatterns("/verifyCode/**")//验证码放行//放行手机注册
                .excludePathPatterns("/fastDfs/**")//fastDfs放行
                .excludePathPatterns("/shop/**")//放行店铺入驻...
                .excludePathPatterns("/user/**")//放行前后台登录
//                .excludePathPatterns("/menu/**")//放行菜单权限
//                .excludePathPatterns("/permission/**")//放行按钮权限
                .excludePathPatterns();

    }
}
